package br.urca.report;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import br.com.caelum.vraptor.jasperreports.Report;

public class AbstractReport implements Report {
	
	private List<?> data;
    private Map<String, Object> parameters;
    private String template;
    private String fileName;
    
	public AbstractReport(List<?> data, String template, String fileName) {
		super();
		this.data = data;
		this.template = template;
		this.fileName = fileName;
		this.parameters = new HashMap<String, Object>();
	}

	@Override
	public String getTemplate() {
		return this.template;
	}

	@Override
	public Map<String, Object> getParameters() {
		return this.parameters;
	}

	@Override
	public Collection<?> getData() {
		return data;
	}

	@Override
	public String getFileName() {
		return this.fileName + System.currentTimeMillis();
	}

	@Override
	public Report addParameter(String parameter, Object value) {
		this.parameters.put(parameter, value);
		return this;
	}

	@Override
	public boolean isCacheable() {
		return true;
	}

}
